package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type Entity struct {
	Name string `json:"name,omitempty" form:"name"`
	Age  string `json:"age,omitempty" form:"age"`
}

func main() {
	g := gin.Default()
	g.GET("/", BindParam)
	err := g.Run()
	if err != nil {
		return
	}
}

func BindParam(g *gin.Context) {
	var entity Entity
	err := g.ShouldBind(&entity)
	if err != nil {
		return
	}
	g.JSON(http.StatusOK,
		entity)
}
